1 using System;
2 using
System.Collections.Generic;
3 using
System.ComponentModel;
4 using
System.Data;
5 using
System.Drawing;
6 using
System.Linq;
7 using
System.Text;
8 using
System.Windows.Forms;
9 using
System.Data.SqlClient;
10 namespace
WarehouseManagementSystem
11 {
12     
public partial class frmLowStockReport : Form
13     {
14    
15         SqlConnection con =
null;
16         SqlCommand cmd =
null;
17         ConnectionString cs =
new ConnectionString();
18         
public frmLowStockReport()
19         {
20             InitializeComponent();
21         }
22
23         
private void frmLowStockReport_Load(object sender, EventArgs e)
24         {
25             
try{
26                 
27                 rptLowStock rpt =
new rptLowStock();
28                 
//The report you created.
29                 cmd =
new SqlCommand();
30                 SqlDataAdapter myDA =
new SqlDataAdapter();
31                 POS_DBDataSet myDS =
new POS_DBDataSet();
32                 
//The DataSet you created.
33                 con =
new SqlConnection(cs.DBConn);
34                 cmd.Connection = con;
35                 cmd.CommandText =
"SELECT * from Temp_Stock,Product where Temp_Stock.ProductID=Product.ProductID and quantity < 10 order by ProductName";
36                 cmd.CommandType = CommandType.Text;
37                 myDA.SelectCommand = cmd;
38                 myDA.Fill(myDS,
"Temp_Stock");
39                 myDA.Fill(myDS,
"Product");
40                 rpt.SetDataSource(myDS);
41                 
this.crystalReportViewer1.ReportSource = rpt;
42                 
this.Visible = true;
43             }
44             
catch (Exception ex)
45             {
46                 MessageBox.Show(ex.Message,
"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
47             }
48         }
49
50      
51     }
52 }


Gõ tìm kiếm nhanh...